#ifndef TX_H
#define TX_H
#include "globalParameters.h"

class Tx{
public:
	Tx(int id, int xPos,int yPos,double txPower, GlobalParameters parameters);
	void setCurrentCW(int);
	int getCurrentCW();
	void setSuccessfulPackets(int);
	int getSuccessfulPackets();
	void setFailedPackets(int);
	int getFailedPackets();
	void setTimeToFire(int);
	int getTimeToFire();
	void print();
	int getRounds();
	void setRounds(int);
	bool getActive();
	void setActive(bool);
	void setReceiver(int);
	int getReceiver();
	int getX();
	int getY();
	double getPower();
	int getId();
	void incrementInterference(double);
	bool canTransmit(GlobalParameters);
	double getInterference();
	void setInterference(double);
	double getNoise();
	void setNoise(double);
	int getSlotsToGo();
	void setSlotsToGo(int);
	void decrementSlotsToGo();
	void setCwOnFail(int,GlobalParameters);
	void setCwOnSuccess(int,GlobalParameters,int);
	void incrementRounds();
	void updateTimeToFire(GlobalParameters);
	void incrementSuccessfulPackets();
	void incrementFailedPackets();
	void decreaseTimeToFire(double);
	bool hasTransmitted();
	void setTransmitValue(bool);
	void setSlotsToGoOnFail();
	void setSlotsToGoOnStart();
	int getQueueSize();
	void setQueueSize(int);
	void incrementQueueSize();
	void decrementQueueSize();
	int getTimeWaiting();
	void setTimeWaiting(int);
	void checkForMorePackets(double,GlobalParameters);
	

private:
	int txID;//unique id of the node
	int xPos;//x-coordinate
	int yPos;//y-coordinate
	double txPower;//transmission power in watts
	int currentCW;//size of current contention window
	int successfulPackets;//number of successfully transmitted packets so far
	int failedPackets;//numbet of failed packets so far
	int timeToFire;//number of time slots before the node can fire next packet	
	int rounds;
	bool active;
	int receiver;
	double interference;
	double noise;
	int slotsToGo;
	bool transmitValue;
	int queueSize;
	int timeWaiting;
};

#endif
